|
|
|
|
|
|
|
Figure 6.11
Program SubEdge uses image subtraction to detect edges. |
|
|
|
|
|
|
|
|
would have to examine the color components for the pixel in position (X + 1, Y + 1), and that position lies outside the picture. |
|
|
|
|
|
|
|
|
It is also important in this code that the each pixel's new value depends only on its current value and the value of another pixel that has not yet been modified. If the code subtracted a pixel's value from a pixel that had already been modified, such as the pixel in position (X - 1, Y - 1), the results would be unpredictable. |
|
|
|
 |
|
|
|
|
For Y = 0 To picOriginal.ScaleHeight - 2
For X = 0 To picOriginal.ScaleWidth - 2
With pixels(X, Y)
.rgbRed = Abs(CInt(.rgbRed) - _
pixels(X + 1, Y + 1).rgbRed)
.rgbGreen = Abs(CInt(.rgbGreen) - _
pixels(X + 1, Y + 1).rgbGreen)
.rgbBlue = Abs(CInt(.rgbBlue) - _
pixels(X + 1, Y + 1).rgbBlue)
End With
Next X
Next Y |
|
|
|
|
|
|
|
|
Example program SubEdge2, shown in Figure 6.12, subtracts each pixel in an image from all of those surrounding it, and it combines the results. The final image shows edges more strongly in all directions. |
|
|
|
|
|
|
|
|
As its name suggests, image averaging is the process of averaging the pixel values of several images. The main use for image averaging is noise reduction. If you have several images of the same scene, each containing random noise, you can use the average of the images to reduce the noise. |
|
|
|
|
|